#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
#include <set>
#define MAXN 505
#define MAXM 100005
#define INF (1 << 29)
#define pii pair<int, int>
using namespace std;

int N, M, K;
int markets[5];
vector<pii> graph[10005];
int shortest[5][10005];
bool isMarket[10005];

void dijkstra(int start){
    priority_queue<pii, vector<pii>, greater<pii> > pq;
    pq.push(pii(0, markets[start]));

    while (!pq.empty()){
        int curnode = pq.top().second;
        int curdist = pq.top().first;
        pq.pop();

        if (shortest[start][curnode] <= curdist) continue;

        shortest[start][curnode] = curdist;
        for (int i=0;i<graph[curnode].size();i++){
            int nextnode = graph[curnode][i].second;
            int nextdist = graph[curnode][i].first + curdist;
            if (nextdist < shortest[start][nextnode])
                pq.push(pii(nextdist, nextnode));
        }
    }
}

int main()
{
    freopen("relocate.txt","r", stdin);
    scanf("%d%d%d", &N, &M, &K);
    for (int i=0;i<N;i++) isMarket[i] = false;
    for (int i=0;i<K;i++){
        scanf("%d", &markets[i]);
        markets[i]--;
        isMarket[markets[i]] = true;
    }
    for (int i=0;i<M;i++){
        int a, b, L;
        scanf("%d%d%d", &a, &b, &L);
        a--; b--;
        graph[a].push_back(pii(L, b));
        graph[b].push_back(pii(L, a));
    }
    for (int i=0;i<K;i++){
        for (int j=0;j<N;j++){
            shortest[i][j] = INF;
        }
        dijkstra(i);
    }
    int best = INF;
    int order[K];
    for (int i=0;i<K;i++) order[i] = i;
    do
    {
        int total = INF;
        for (int i=0;i<N;i++)
            if (!isMarket[i])
                total = min(total, shortest[order[0]][i] + shortest[order[K-1]][i]);
        for (int i=1;i<K;i++)
            total += shortest[order[i-1]][markets[order[i]]];
        best = min(best, total);
    }
    while (next_permutation(order, order + K));
    printf("%d\n", best);
    return 0;
}
